<script>
import Vue from 'vue';
export default {
    onLaunch: function () {
        let _this = this;
        uni.getSystemInfo({
            success: function (e) {
                Vue.prototype.statusBar = e.statusBarHeight
                // #ifndef MP
                if (e.platform == 'android') {
                    Vue.prototype.customBar = e.statusBarHeight + 50
                } else {
                    Vue.prototype.customBar = e.statusBarHeight + 45
                }
                Vue.prototype.menu = {
                    top: 20,
                    height: 30
                }
                // #endif

                // #ifdef MP-WEIXIN
                Vue.prototype.$isIOS = (e.system.split(' ') || [])[0] === 'iOS'
                console.log('<>>>>>>>>>>>>>>>>>>>>>>>>>>*************************', _this.isIOS)
                let custom = wx.getMenuButtonBoundingClientRect()
                Vue.prototype.menu = wx.getMenuButtonBoundingClientRect()
                Vue.prototype.customBar = custom.bottom + custom.top - e.statusBarHeight
                // #endif

                // #ifdef MP-ALIPAY
                Vue.prototype.customBar = e.statusBarHeight + e.titleBarHeight
                // #endif
            }
        })

        const tickets = uni.getStorageSync('tickets');
        const value = uni.getStorageSync('identity');
        if (value) {
            if (!_this.$store.state.hasLogin) {
                _this.$store.commit('LOGIN', value);
                _this.$store.commit('GETTICKET', tickets);
                _this.$store.dispatch('GetInfo', {
                    uid: value.uid
                }).then(res => {
                    console.log("获取用户信息成功")
                }).catch((err) => {
                    console.log("===================")
                    console.log(err)
                    uni.showToast({
                        title: '获取用户信息失败',
                        icon: 'none'
                    });
                    _this.$store.dispatch('LogOut');
                })
            }
        }
    },
    onShow: function () {
        console.log('App Show')
    },
    onHide: function () {
        console.log('App Hide')
    }
}
</script>

<style>
@import "./public/css/public.scss";
@import "@/static/iconfont/iconfont.css";
/*每个页面公共css */
page {
    width: 100%;
    height: 100%;
}

::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
    color: transparent;
}
</style>
